package com.wencai.controller;

import com.wencai.common.Result;
import com.wencai.service.WencaiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@Api(value = "问财选股", tags = {"问财选股"})
public class WencaiController {

    @Autowired
    private WencaiService wencaiService;


    @GetMapping("/wencai/aiXuanGu")
    @ApiOperation(value = "执行同花顺策略选股")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "strategy", value = "策略详情", defaultValue = "主板，竞价涨幅大于0", example = "主板，竞价涨幅大于0", dataType = "String", required = true)
    })
    public Result strategyDetailTHS(@RequestParam("strategy") String strategy) {
        try {
            return this.wencaiService.strategy(strategy,1);
        } catch (Exception e) {
            log.error("问财选股异常:", e);
            return null;
        }
    }
}
